﻿using System.Collections.Generic;
using Tp.Dto.Stammdaten;
using Tp.Interfaces.Services;
using Tp.Services.DataLayer;
using Tp.Services.Manager;

namespace Tp.Services
{
	  public class PersonenService : IPersonenService
	  {
			public PersonDto LoadPerson(int personID)
			{
				  using (PersonenDataLayer dl = CreatePersonenDataLayer())
				  {
						return dl.LoadPerson(personID);
				  }
			}

			public List<PersonDto> LoadPersons()
			{
				  List<PersonDto> myList = new List<PersonDto>();

				  PersonDto pers = LoadPerson(1);
				  myList.Add(pers);
				  return myList;

			}

			public void SavePerson(PersonDto person)
			{
				  //toDo: SavePersons
			}

			private static PersonenDataLayer CreatePersonenDataLayer()
			{
				  return (DataManager.CreateDataLayer(typeof(PersonenDataLayer)) as PersonenDataLayer);
			}
	  }
}
